package com.skt.domain.VO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 购物车展示视图对象（VO）
 */
@Data
@Schema(description = "购物车信息展示对象")
public class CartVO {

    @Schema(description = "购物车ID")
    private Long cartId;

    @Schema(description = "用户ID")
    private Long userId;

    @Schema(description = "商品总数量")
    private Integer totalItems;

    @Schema(description = "购物车总金额")
    private BigDecimal totalAmount;

    @Schema(description = "购物车项列表")
    private List<CartItemVO> items;

    @Schema(description = "创建时间")
    private LocalDateTime createdAt;

    @Schema(description = "更新时间")
    private LocalDateTime updatedAt;

    /**
     * 购物车项展示视图对象（VO）
     */
    @Data
    @Schema(description = "购物车项信息展示对象")
    public static class CartItemVO {

        @Schema(description = "购物车项ID")
        private Long id;

        @Schema(description = "服装ID")
        private Long costumeId;

        @Schema(description = "服装名称")
        private String costumeName;

        @Schema(description = "服装主图")
        private String costumeImage;

        @Schema(description = "商家ID")
        private Long merchantId;

        @Schema(description = "商家名称")
        private String merchantName;

        @Schema(description = "数量")
        private Integer quantity;

        @Schema(description = "加入时的日租金（价格快照）")
        private BigDecimal dailyPrice;

        @Schema(description = "是否选中：true-是，false-否")
        private Boolean selected;

        @Schema(description = "租赁天数")
        private Integer rentalDays;

        @Schema(description = "预计租赁开始日期")
        private LocalDate startDate;

        @Schema(description = "预计租赁结束日期")
        private LocalDate endDate;

        @Schema(description = "小计金额（日租金 × 租赁天数 × 数量）")
        private BigDecimal subtotal;

        @Schema(description = "价格是否变动")
        private Boolean priceChanged = false;

        @Schema(description = "当前价格")
        private BigDecimal currentPrice;

        @Schema(description = "是否库存不足")
        private Boolean insufficientStock = false;

        @Schema(description = "可用库存")
        private Integer availableStock;

        @Schema(description = "创建时间")
        private LocalDateTime createdAt;

        @Schema(description = "更新时间")
        private LocalDateTime updatedAt;

        @Schema(description = "删除时间")
        private LocalDateTime deletedAt;
    }
}